<template>
	<view class="floor">
		<view class="floor-title">
			<image style="width: 50rpx;" src="../../static/img/computer_icon.png" mode="widthFix"></image>
			<text class="txt">{{title}}</text>
			<navigator class="link" url="../../pages/list/list">更多</navigator>
		</view>
		<view class="floor-product">
			<view class="product" v-for="(p,i) in productList" :key="i">
				<image class="pic" :src="$base+p.pic" mode="heightFix"></image>
				<text class="title">{{p.title}}</text>
				<view class="footer">
					<text class="price">￥{{p.price}}</text>
					<button @click="showDetails(p.pid)" class="btn" type="primary" size="mini">查看详情</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props:{
			title:{
				type:String,
				required:true
			},
			productList:{
				type:Array,
				required:true
			}
		},
		data() {
			return {
				
			};
		},
		methods:{
			showDetails(lid){
				uni.navigateTo({
					url:`/pages/details/details?lid=${lid}`
				})
			}
		}
	}
</script>

<style lang="scss">
	.floor {
		border-top: $uni-border-width $uni-border-style $uni-border-color;
		border-bottom: $uni-border-width $uni-border-style $uni-border-color;
		box-shadow: 0 0 10rpx $uni-border-color;
		.floor-title {
			display: flex;
			align-items: center;
			padding: $uni-spacing-row-base $uni-spacing-row-base;
			border-bottom: $uni-border-width $uni-border-style $uni-border-color;
			.txt {
				flex: 1;
				margin: 0 $uni-spacing-row-base;
			}
			.link {
				color: $uni-text-color-grey;
			}
		}
		.floor-product {
			border-top: $uni-border-width $uni-border-style $uni-border-color;
			display: flex;
			justify-content: space-around;
			flex-wrap: wrap;
			padding: $uni-spacing-col-base $uni-spacing-row-base;
			.product {
				width: 48%;
				border: $uni-border-width $uni-border-style $uni-border-color;
				border-radius: $uni-border-radius-base;
				margin: $uni-spacing-col-sm 0;
				padding:$uni-spacing-col-base $uni-spacing-row-base;
				.pic {
					height: 200rpx;
					display: block;
					margin: 0 auto;
				}
				.title {
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					display: block;
					margin: $uni-spacing-col-base 0;
				}
				.footer {
					display: flex;
					justify-content: space-between;
					align-items: center;
					.price {
						color: $uni-color-primary;
					}
					.btn {
						padding: 0 $uni-spacing-col-base;
					}
				}
			}
		}
	}

</style>